package com.hong;

import com.hong.service.OrderService;
import com.spring.HongApplicationContext;

public class Test {

    public static void main(String[] args) {
        // 启动 spring
        HongApplicationContext hongApplicationContext = new HongApplicationContext(AppConfig.class);

        // getBean()
        OrderService orderService = (OrderService) hongApplicationContext.getBean("orderService");
        System.out.println(orderService);

        // 测试单例
//        System.out.println(hongApplicationContext.getBean("orderService"));
//        System.out.println(hongApplicationContext.getBean("orderService"));
//        System.out.println(hongApplicationContext.getBean("orderService"));

        orderService.test();
    }

}
